-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here

function Map(mode, lhs, rhs, opts)
    local options = { noremap = true, silent = true }
    if opts then
        options = vim.tbl_extend("force", options, opts)
    end
    vim.keymap.set(mode, lhs, rhs, options)
end

-- visual model------------------------------------------------
Map("v", "H", "^")
Map("v", "L", "g_")

-- insert model------------------------------------------------
Map("i", "jk", "<ESC>")

-- nomal model------------------------------------------------
-- quick move cursor
Map("n", "H", "^")
Map("n", "L", "g_")
Map("n", "dH", "d^")
Map("n", "dL", "d$")
-- select all
Map("n", "<C-a>", "GVgg")
-- no highlight
Map("n", "<leader>nh", ":nohl<CR>", { desc = "no highlight" })
-- go back
Map("n", "gb", "<C-o>")





-- 命令模式退出
Map("c","jk","<c-c>")




-- 插件快捷键--------------------------------------------------------------------------------------------------------------
-- fittencode
Map("i", "<a-j>", function()
	require("fittencode").accept_all_suggestions()
end, { desc = "accept_all_suggestions" })
Map("i", "<a-k>", function()
	require("fittencode").dismiss_suggestions()
end, { desc = "dismiss_all_suggestions" })
-- Map("n", "<leader>fe", "<cmd>Fitten enable_completions<cr>", { desc = "enable fittencode", silent = false })
-- Map("n", "<leader>fd", "<cmd>Fitten disable_completions<cr>", { desc = "close fittencode", silent = false })
-- Map("n", "<leader>fc", "<cmd>Fitten start_chat<cr>", { desc = "start_chat", silent = false })



